﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Geotools.Geometries;

namespace AzukiMap.Map
{
    public delegate void ScreenScaleChangedHandler(object sender, ScreenScaleChangedArgs e);
    public delegate void LayerContainerMovedHandler(object sender, LayerContainerMovedArgs e);
    public delegate void MouseMovedOnScreenHandler(object sender, MouseMovedOnScreenArgs e);

    public partial class MapLayerControl 
    {
        public event ScreenScaleChangedHandler ScreenScaleChanged;
        public event LayerContainerMovedHandler LayerContainerMoved;
        public event MouseMovedOnScreenHandler MouseMovedOnScreen;

        protected virtual void OnContainerMoved(LayerContainerMovedArgs e)
        {
            if (LayerContainerMoved != null)
            {
                LayerContainerMoved(this, e);
            }
        }

        protected virtual void OnScaleChanged(ScreenScaleChangedArgs e)
        {
            if (ScreenScaleChanged != null)
            {
                ScreenScaleChanged(this, e);
            }
        }

        protected virtual void OnMouseMoved(MouseMovedOnScreenArgs e)
        {
            if (MouseMovedOnScreen != null)
            {
                MouseMovedOnScreen(this, e);
            }
        }
    }

    public class LayerContainerMovedArgs : EventArgs
    {
        double _moveX = 0;
        double _moveY = 0;
        double _adjX;
        double _adjY;

        public double AdjX
        {
            get { return _adjX; }
            set { _adjX = value; }
        }

        public double AdjY
        {
            get { return _adjY; }
            set { _adjY = value; }
        }

        public double MoveX
        {
            get { return _moveX; }
        }

        public double MoveY
        {
            get { return _moveY; }
        }

        public LayerContainerMovedArgs(double moveX, double moveY, double adjX, double adjY)
        {
            _moveX = moveX;
            _moveY = moveY;
            _adjX = adjX;
            _adjY = adjY;
        }
    }

    public class ScreenScaleChangedArgs : EventArgs
    {
        double _anchorX = 0;
        double _anchorY = 0;
        double _adjX;
        double _adjY;
        double _scaleRatio;

        public double ScaleRatio
        {
            get { return _scaleRatio; }
        }

        public double MoveX
        {
            get { return _anchorX; }
        }

        public double MoveY
        {
            get { return _anchorY; }
        }

        public double AdjX
        {
            get { return _adjX; }
        }

        public double AdjY
        {
            get { return _adjY; }
        }

        public ScreenScaleChangedArgs(double scaleRatio, double anchorX, double anchorY, double adjX, double adjY)
        {
            _anchorX = anchorX;
            _anchorY = anchorY;
            _scaleRatio = scaleRatio;
            _adjX = adjX;
            _adjY = adjY;
        }

    }

    public class MouseMovedOnScreenArgs : EventArgs
    {
        double _mouseX;
        double _mouseY;

        public MouseMovedOnScreenArgs(double mouseX, double mouseY)
        {
            _mouseX = mouseX;
            _mouseY = mouseY;
        }

        public double MouseX
        {
            get { return _mouseX; }
        }

        public double MouseY
        {
            get { return _mouseY; }
        }
    }

}
